/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hirt;

import java.awt.Point;

/**
 *
 * @author zamille
 */
public class ServerConstants {

    public static String LOCALIPADDRESS = "0.0.0.0";
    public static String REMOTEIPADDRESS = "146.163.150.102";
    public static String SERVERIPADDRESS = "146.163.146.176";
    public static int PORT = 4445;
    public static String FILENAME = "testScenario.txt";
    public static String SCENAIORFOLDERNAME = "Scenarios";

    // Light frame and animation data.
    public static int   LIGHT_STATE_OFF         = 0;
    public static int   LIGHT_STATE_CAUTION     = 1;
    public static int   LIGHT_STATE_LEFT_ARROW  = 2;
    public static int   LIGHT_STATE_RIGHT_ARROW = 3;
    public static int   TOTAL_LIGHT_STATES      = 4;

    public final static int AMBULANCE               = 0;
    public final static int FIRE_TRUCK              = 1;
    public final static int POLICE_CAR              = 2;
    public final static int IDOT_VEHICLE            = 3;
    public final static int TOW_TRUCK               = 4;
    public final static int VICTIM_VEHICLE          = 5;
    public final static int WORLD                   = 6;
    public final static int HORIZONTAL_LANE         = 7;
    public final static int VERTICAL_LANE           = 8;
    public final static int LEFT_ON_RAMP            = 10;
    public final static int RIGHT_ON_RAMP           = 11;
    public final static int LEFT_OFF_RAMP           = 12;
    public final static int RIGHT_OFF_RAMP          = 13;
    public final static int CONE                    = 14;
    public final static int SIGN                    = 15;
    public final static int FIRST_AID               = 16;
    public final static int BROOM                   = 17;
    public final static int FLARE                  = 18;
    public final static int CURSOR                  = 19;
    public final static int HORIZONTAL_SHOULDER     = 20;
    public final static int VERTICAL_SHOULDER       = 21;
    public final static int DRUM                    = 22;

    //float[][] colorList =
    public final static int[][] DEFAULT_ITEMS_BY_ROLE  =
    {
        // DEFAULT_CONES
        new int []
        {
            4,      // Ambulance
            12,     // Firetruck
            4,      // Police
            6,      // Service Patrol
            2,      // Tow Truck
            0       // Victim
        },
        
        // DEFAULT_SIGNS
        new int []
        {
            0,      // Ambulance
            1,      // Firetruck
            0,      // Police
            1,      // Service Patrol
            1,      // Tow Truck
            0       // Victim
        },
        
        // DEFAULT_DRUMS
        new int []
        {
            0,      // Ambulance
            3,      // Firetruck
            0,      // Police
            3,      // Service Patrol
            0,      // Tow Truck
            0       // Victim
        },
        
        // DEFAULT_FLARES
        new int []
        {
            0,      // Ambulance
            6,      // Firetruck
            4,      // Police
            4,      // Service Patrol
            3,      // Tow Truck
            0       // Victim
        }
    };

    public static int getItemIndexByType( String type )
    {
        int typeIndex;

        // Get this type String's type index
        // (probably should be its own function... prob should have been int to begin with).
        for( typeIndex = 0; typeIndex < ITEM_TYPE_NAME.length; typeIndex++ )
        {
            if( type.equals( ITEM_TYPE_NAME[typeIndex] )  )
            {
                break;
            }
        }

        // Make sure we actually found a type name.
        if( typeIndex == ITEM_TYPE_NAME.length )
        {
            return( -1 );
        }

        return( typeIndex );
    }

    // This is way Sloppy Joe.
    public static int getDefaultNumberOfItemsByRole( int typeIndex, int roleId )
    {
        // Make sure we actually found a type name.
        if( typeIndex == ITEM_TYPE_NAME.length )
        {
            // We found none of these.
            return( 0 );
        }
        else
        {
            switch( typeIndex )
            {
                case CONE:
                {
                    return( DEFAULT_ITEMS_BY_ROLE[0][roleId] );
                }

                case SIGN:
                {
                    return( DEFAULT_ITEMS_BY_ROLE[1][roleId] );
                }

                case DRUM:
                {
                    return( DEFAULT_ITEMS_BY_ROLE[2][roleId] );
                }

                case FLARE:
                {
                    return( DEFAULT_ITEMS_BY_ROLE[3][roleId] );
                }

                default:
                {
                    return( 0 );
                }
            }
        }
    }

    /**
     * The list of item types.
     *
     * @author Tim Pruitt
     */
    public final static String ITEM_TYPE_NAME[] =
    {
        "ambulance",
        "fire_truck",
        "police_car",
        "IDOT_vehicle",
        "tow_truck",
        "victim_car",
        "world",
        "horizontal_lane",
        "vertical_lane",
        "shoulder",
        "left_on_ramp",
        "right_on_ramp",
        "left_off_ramp",
        "right_off_ramp",
        "cone",
        "sign",
        "first_aid",
        "broom",
        "flare",
        "cursor",
        "horizontal_shoulder",
        "vertical_shoulder",
        "drum"
    };

    /**
     * The list of item display names.
     *
     * @author Tim Pruitt
     */
    public final static String ITEM_DISPLAY_NAME[] =
    {
        "Ambulance",
        "Fire Truck",
        "Police Car",
        "Service Patrol Vehicle",
        "Tow Truck",
        "Victim Vehicle",
        "World",
        "Horizontal Lane",
        "Vertical Lane",
        "Shoulder",
        "Left  On-Ramp",
        "Right On-Ramp",
        "Left  Off-Ramp",
        "Right Off-Ramp",
        "Cone",
        "Sign",
        "First Aid Kit",
        "Broom",
        "Flare",
        "Cursor",
        "Horizontal Shoulder",
        "Vertical Shoulder",
        "Drum"
    };

    /**
     * The list of item photo locations in the project.
     *
     * @author Tim Pruitt
     */
    public final static String ITEM_PHOTO_LOCATION[] =
    {
        "/graphics/car_ambulance_64x128.png",
        "/graphics/car_firetruck_80x196.png",
        "/graphics/car_police_64x128.png",
        "/graphics/car_idot_64x128.png",
        "/graphics/car_towtruck_64x144.png",
        "/graphics/car1_64x128.png",
        "/graphics/grass.png",
        "horizontal lane",
        "vertical lane",
        "Shoulder",
        "LeftOn Ramp",
        "Right on Ramp",
        "left Off Ramp",
        "right off ramp",
        "/graphics/cone.png",
        "Advanced Warning Sign",
        "First Aid Kit",
        "Broom",
        "/graphics/flares_50x50.png",
        "cursor",
        "/graphics/shoulder.png",
        "/graphics/shoulder.png",
        "/graphics/drum_50x50.png"
    };

    /**
     * The list of item dimensions in the gameScenePanel.
     *
     * @author Tim Pruitt
     */
    public final static Point ITEM2D_DIMENSIONS[] =
    {
        new Point( 32, 64 ),   //ambulance
        new Point( 40, 98 ),   //fire truck
        new Point( 32, 64 ),   //police car
        new Point( 32, 64 ),   //IDOT vehicle
        new Point( 32, 72 ),   //tow truck
        new Point( 32, 64 ),   //victim car
        new Point( 0, 0 ),          //world
        new Point( 132, 64 ),   //horizontal lane
        new Point( 64, 132 ),   //vertical lane
        new Point( 32, 132 ),   //shoulder
        new Point( 48, 48 ),   //left on ramp
        new Point( 48, 48 ),   //right on ramp
        new Point( 48, 48 ),   //left off ramp
        new Point( 48, 48 ),   //right off ramp
        new Point( 8, 8 ),    //cone
        new Point( 32, 32 ),    //sign
        new Point( 16, 16 ),    //first aid
        new Point( 16, 16 ),    //broom
        new Point( 8, 8 ),    //flare
        new Point( 8, 8 ),           //cursor
        new Point( 132, 64 ),           //horizontal shoulder
        new Point( 64, 132 ),           //vertical shoulder
        new Point( 16, 16)      // drum
    };

    /**
     * The length of the string that should be deleted from the item class name.
     *
     * @author Tim Pruitt
     */
    public static final int HIRT_PACKAGE_REMOVAL = 5;

    /**
     * The list of item classes.
     *
     * @author Tim Pruitt
     */
    public final static String ITEM_CLASS[] =
    {
        //Only valid when in the HIRT Package
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Automobile.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Lane.class.toString().substring( HIRT_PACKAGE_REMOVAL ),
        Item2D.class.toString().substring( HIRT_PACKAGE_REMOVAL )
    };
}
